'''
Created on Apr 22, 2012

@author: samindaw
'''

from net.pycbr.CBR import CBREngine, read_casebase
import os

#load the casebase from the file.
samples_path="resources/samples/"
if (not os.path.isdir("resources")):
    samples_path="../"+samples_path
cb=read_casebase(samples_path+"movies_2011.txt")

#instantiate the CBR engine
cbr=CBREngine(cb)

#run the tests

#test 1
data = {"genre":"action", "released":"december"}
print "Action movies released on december - "+str(data)
results=cbr.search_case(data,10)
for result in results: print str(result[0]["title"].replace("_"," "))+" ("+str(result[0].get("released",""))+")\t: "+str(result[1])
print

#test 2
data = {"genre":"action", "released":"fall"}
print "Action movies released on fall - "+str(data)
results=cbr.search_case(data,10)
for result in results: print str(result[0]["title"].replace("_"," "))+" ("+str(result[0].get("released",""))+")\t: "+str(result[1])
print

#test 3
data = {"starring":"Kristen", "genre":"love"}
print "Romance movies of Kristen - "+str(data)
results=cbr.search_case(data,10)
for result in results: print str(result[0]["title"].replace("_"," "))+" ("+str(result[0].get("genre",""))+")\t: "+str(result[1])
